<?php

namespace core\lib\db;
use core\Config;

class Mysql
{
    private $_db;
    private $table = '';

    // SELECT * FROM `` WHERE `` = '';
    // INSERT INTO `` VALUES ();
    // UPDATE `` SET `` = '' WHERE `` = '';
    // DELETE FROM `` WHERE `` = '';

    public function __construct()
    {
        try {
            $host   = Config::get('db.server');
            $dbname = Config::get('db.database_name');
            $user   = Config::get('db.username');
            $pass   = Config::get('db.password');
            $this->_db = new \PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
            $this->_db->query('set names utf8;');
            return $this;
        } catch (\Exception $e) {
            throw new \Exception( $e->getMessage() );
        }
    }

    public function table() {}
    public function name() {}
    public function where() {}
    public function order() {}
    public function limit() {}
    public function page() {}

    public function find() {}
    public function select() {}
    public function insert() {}
    public function insertAll() {}
    public function update() {}
    public function delete() {}

    public function count() {}
    public function sum() {}
    public function avg() {}
    public function max() {}
    public function min() {}

}
